<?
function check_admin_session() {
    session_start();
    if (empty($_SESSION['admin_logged_in'])) {
        header('Location: login.php');
        exit;
    }
    if (!isset($_SESSION['admin_login_time']) || (time() - $_SESSION['admin_login_time']) > 3600) {
        session_unset();
        session_destroy();
        header('Location: login.php');
        exit;
    } else {
        $_SESSION['admin_login_time'] = time();
    }
}
?>